package com.hht.study.proxy.dynamic.jdk;

import java.lang.reflect.Proxy;

/**
 * 代理对象工厂
 * @author hht
 * @date 2022/3/6
 */
public class JdkProxyFactory {

    /**
     * 获取指定对象的代理对象
     * @param target
     * @return
     */
    public static Object getProxy(Object target){
        return Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getClass().getInterfaces(),new MyInvocationHandler(target));
    }
}
